<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础</title>
</head>

<body>
    <div id="app">
        <h2 v-text="message"></h2>
        <h2 v-text="info + '!'"></h2>
        <h2>{{ message + '!'}} +1</h2>
        <p v-html="content"></p>
        <input type="button" value="事件绑定" v-on:click="doit">
        <input type="button" value="事件绑定" @dblclick="doit">
        <h2 @click="changeFood">{{food}}</h2>
        <input type="button" value="切换" @click="changeIsShow">
        <input type="button" value="累加年龄" @click="addAge">
        <img v-show="isShow" src="img/图片1.gif" alt="">
        <img v-show="age>=18" src="img/图片1.gif" alt="">
        <p v-if="isShow">我是p标签</p>
        <p v-if="age>=18">我是p标签</p>
    </div>
    <script src="http://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            methods: {
                doit: function () {
                    alert(1)
                },
                changeFood: function () {
                    // console.log(this.food);
                    this.food += 333
                },
                changeIsShow: function () {
                    this.isShow = !this.isShow
                },
                addAge: function () {
                    this.age++
                }
            },
            data: {
                message: 'zzzzz!!!',
                info: '11',
                content: '<a href="http://www.baidu.com">百度</a>',
                food: '222',
                isShow: 'false',
                age: 16
            }
        })
    </script>
</body>

</html>